if(!jsx3.lang.Class.forName("ux.cdb.admin.mechanism.cooOrg.CooOrgLoanAssist.builder.CooOrgLoanAssistAddress")) {
	jsx3.lang.Class.defineClass("ux.cdb.admin.mechanism.cooOrg.CooOrgLoanAssist.builder.CooOrgLoanAssistAddress",
			ux.megatron.gui.WizardPanel,
			null,
			function (block) {
				/**
				 * instance initializer
				 * @param strName {String} unique name distinguishing this object from all other JSX GUI objects in the JSX application
				 * @param vntLeft {int|String} either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
				 * @param vntTop {int|String} either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
				 * @param vntWidth {int|String} either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
				 * @param vntHeight {int|String} either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
				 * @param strHTML {String} Text/HTML markup to place in the jsx3.gui.Block instance
				 */
				block.prototype.wizard=null;
				
				block.prototype.init = function(strName, vntLeft, vntTop, vntWidth, vntHeight, strHTML) {
					//call constructor for super class (the super expects the name of the object and the function that it is an instance of)
					this.jsxsuper(strName, vntLeft, vntTop, vntWidth, vntHeight, strHTML);
				};

				block.prototype.initialize = function(msg) {
					this.wizard = this.getAncestorOfType("ux.cdb.admin.mechanism.cooOrg.CooOrgWizard");
					//this.wizard = this.getAncestorOfType("ux.megatron.gui.SteppedWizard");
					if (this.wizard.isEdit)
					{//current mode is edit mode ,call the server operation to get the address info
						ux.megatron.util.Dwr.callDwr("MaintainCooperOrgUCC", "getAddressListByCondition", [this.wizard.orgId], this, this.addressInfoLoaded);
					}
					else
					{
						//link the province with current user's province
						/*
						this.getDescendantOfName("lblRegRegionValue").getDescendantOfName("selValue1").setValue(ux.cdb.admin.Privilege.getProvinceCode());
						this.getDescendantOfName("lblRegRegionValue").onSelectChanged();
						this.getDescendantOfName("lblOfficeRegionValue").getDescendantOfName("selValue1").setValue(ux.cdb.admin.Privilege.getProvinceCode());
						this.getDescendantOfName("lblOfficeRegionValue").onSelectChanged();
						*/
						var defaultProvince = ux.cdb.admin.Privilege.getProvinceCode();
						this.getDescendantOfName("lblRegRegionValue").setDataByObject({adminRegionCode: defaultProvince});
						this.getDescendantOfName("lblOfficeRegionValue").setDataByObject({adminRegionCode: defaultProvince});

					}
					this.focus();
				}
				
				/*
				 * get the back message contain the address info
				 */
				block.prototype.addressInfoLoaded=function(obj)
				{
					var message=obj.content.data;
					console.log("\n\n\t [addressinfo:38]got the address info"+ux.megatron.util.JSON.JSONtoString(message));
					for(var i=0;i<message.length;i++)
					{
						if (message[i].addrTypeCode=="02")
						{ 
							this.getDescendantOfName("blkRegAddress").setDataByObject(message[i]);
							this.wizard.regAddrId=message[i].addrId;
						}
						else
						{
							this.getDescendantOfName("blkOfficeAddress").setDataByObject(message[i]);
							this.wizard.offAddrId=message[i].addrId;
						}
					}
					this.wizard.addressObj=message;

					
				}

				block.prototype.onNext = function(objWIZARD, objBUTTON, objEVENT, strCURRENTPANEL) {
					
					//validate
					var val1=this.getDescendantOfName("blkRegAddress").doValidate();
					var val2=this.getDescendantOfName("blkOfficeAddress").doValidate();
					var tip;
					if (val1!=null || val2!=null)
					{
						if (val1!=null)
						{
							var tip = val1[0].label ? val1[0].label + ":" +val1[0].message : val1[0].message;
						}
						else
						{
							var tip = val2[0].label ? val2[0].label + ":" +val2[0].message : val2[0].message;
						}
						this.getAncestorOfType("ux.cdb.admin.mechanism.cooOrg.CooOrgLoanAssist.builder.Builder").setWarnMessage(tip);
						return "NONE";
					}
					this.getAncestorOfType("ux.cdb.admin.mechanism.cooOrg.CooOrgLoanAssist.builder.Builder").clearWarnMessage();
					this.wizard.step2=true;
					return null; // return "NONE" to not next panels
				}
				block.prototype.backmessage=function(objEvent)
				{
				}

				block.prototype.onPrev = function(objWIZARD, objBUTTON, objEVENT, strCURRENTPANEL) {
					return this.onNext(objWIZARD, objBUTTON, objEVENT, strCURRENTPANEL);
				}
				block.prototype.onFinish = function(objWIZARD, objBUTTON, objEVENT, strCURRENTPANEL) {
					//validate
					var val1=this.getDescendantOfName("blkRegAddress").doValidate();
					var val2=this.getDescendantOfName("blkOfficeAddress").doValidate();
					var tip;
					if (val1!=null || val2!=null)
					{
						if (val1!=null)
						{
							var tip = val1[0].label ? val1[0].label + ":" +val1[0].message : val1[0].message;
						}
						else
						{
							var tip = val2[0].label ? val2[0].label + ":" +val2[0].message : val2[0].message;
						}
						this.getAncestorOfType("ux.cdb.admin.mechanism.cooOrg.CooOrgLoanAssist.builder.Builder").setWarnMessage(tip);
						return "NONE";
					}
					this.getAncestorOfType("ux.cdb.admin.mechanism.cooOrg.CooOrgLoanAssist.builder.Builder").clearWarnMessage();
									
					var saver=this.wizard.getDescendantsOfType("ux.cdb.admin.mechanism.cooOrg.CooOrgLoanAssist.builder.CooOrgLoanAssistSummary")[0];
		
					//if current mode is edit mode permit user click finish to save&exit
					saver.saveSummeryInfo();
					
					
					
					return null; // return "NONE" to not last status
				}

				block.prototype.onRevert = function(objWIZARD, objBUTTON, objEVENT, strCURRENTPANEL) {
					return null; // return "NONE" to not last status
				}

				block.prototype.onCancel = function(objWIZARD, objBUTTON, objEVENT, strCURRENTPANEL) {
					this.getAncestorOfType("ux.cdb.admin.mechanism.cooOrg.CooOrgWizard").onClose();
					return null; // return "NONE" to not advance panels
				}

				block.prototype.onCustomNav = function(objWIZARD, objBUTTON, objEVENT, strCURRENTPANEL) {
					return null; // return "NONE" to not advance panels
				}

				block.prototype.onBeforeShow = function(objWIZARD, objBUTTON, objEVENT, strLASTPANEL) {
					if(!this.getChild(0)) {
						var me = this;
						ux.megatron.Main.loadUIResourceAsync(me, "ux.cdb.admin","ux/cdb/admin/mechanism/cooOrg/CooOrgLoanAssist/builder/step2/ui/CooOrgLoanAssistAddressContent.xml", me, me.initialize);
					}
					return null; // return "NONE" to not advance panels
				}

				block.prototype.onAfterHide = function(objWIZARD, objBUTTON, objEVENT, strNEXTPANEL) {
					return null; // return "NONE" to not advance panels
				}
			}
	);
}
